package spe.ui.editor;

import org.eclipse.gef.requests.CreationFactory;

import spe.model.spem.SPEMElement;
import spe.model.spem.SPEMFactory;

public class SPECreationFactory implements CreationFactory 
{
	private String elementId;
	private SPEMElement element;
	private SPEMFactory elementFactory;
	
	public SPECreationFactory(String elementId, SPEMFactory elementFactory)
	{
		this.elementFactory = elementFactory;
		this.elementId = elementId;
		//System.out.println(String.format("[SPECreationFactory] Element Id: %s", elementId));
	}
	
	@Override
	public Object getNewObject() 
	{
		element = elementFactory.createElementById(elementId);
		//System.out.println(String.format("[SPECreationFactory] Element Id: %s; Element; %s", elementId, element));
		return element;
	}

	@Override
	public Object getObjectType()
	{
		return elementId;
	}

}
